<?php include "header.php";?>
<div id="all">
    <div id="main">
			<div id="m-left">
				<div class="sidebar">
					<div class="title">
						<?php echo ($lang ==0)? "Danh mục" : "Menu";?>
					</div>
					<div class="content">
						<ul>
						<?php
							if($lang == 0){
								$sqlMenus = "select id, vi_name as name, url from tblmenu where parent_id =0";
							} else{
								$sqlMenus = "select id, en_name as name, url from tblmenu where parent_id =0";
							}
							$rsMenus = mysql_query($sqlMenus) or die(mysql_error());
							while($menu = mysql_fetch_object($rsMenus)){
								echo "<li><a href='".(($menu->url =="")? (ROOT_PATH."/m/".$menu->id) : ROOT_PATH.$menu->url)."'>".$menu->name."</a></li>";
							}
						?>
						</ul>
					</div>
				</div><!-- end of sidebar -->
			</div>
			<div id="m-mid">
				
				
				
					<div class="title">
					<?php
						if($lang == 0){
							echo "Thư viện tài liệu";
						}else{
							echo "Library";
						}
					?>
					</div>
					<div class="container">
						<ul id="documents">
							
                 <?php
		

			   
			  				$query="select * from tblresource order by id desc";
			
						  
						  	$result = mysql_query($query);
							$total = mysql_num_rows($result);
							$perPage = 10;
							$numOfPage = ceil($total/$perPage);
							
							//echo "Tong so ban ghi la : ".$total."<br>";
							//echo "Moi trang co so ban ghi la : ".$perPage."<br>";
							//echo "Tong so trang la : ".$numOfPage."<br>";
							if($_GET['page']=="")
							{
									$start=0;		  
							}
							else
							{
							if(!isset($_GET["page"]))
							{
									$start=0;
							}
							$start=($_GET['page']-1)*$perPage;
							}
							$query2 = "SELECT * FROM tblresource LIMIT $start,$perPage";
							$result2 = mysql_query($query2);
							while($row2 = mysql_fetch_array($result2))
							{
									
                			if($lang == 0){
									 echo "<li><span>".$row2["vi_name"]."</span><a href='".$row2["link"]."' title='Download tài liệu'><img src='".ROOT_PATH."/images/download.png' alt=''/></a></li>";
								}else{
									 echo "<li><span>".$row2["en_name"]."</span><a href='".$row2["link"]."' title='Click here to download'><img src='".ROOT_PATH."/images/download.png' alt=''/></a></li>";
								}
               
      
		      				}

							$ht=$_GET["page"];
							$tien=$_GET["page"]+1;
							$lui=$_GET["page"]-1;
							
?>
			
               
						
						</ul>
						<div class="paging">
                        <?php if($lang == 0){
							$txtnext="Trang sau";
                            $txtpri="Trang trước";
						}else{
							$txtnext="Next";
                            $txtpri="Previous";
						}?>
							<?php
							if($lui>0)
							{
							echo "<a href='index.php?rt=tailieu&page=".$lui."'><strong><font color='#FF0000'> ".$txtpri." -</font></strong></a> ";	
								}
							for($i=1;$i<=$numOfPage;$i++)
							{
								if($_GET["page"]==$i)
								{
									echo "<a href='tailieu&page=".$i."'><strong><font color='#FF0000'>".$i."</font></strong></a> ";	
								}
								else
								{
									echo "<a href='tailieu&page=".$i."'>".$i."</a> ";	
								}
							}
							if (($tien<=$numOfPage) && (5<$numOfPage))
							{
								echo "<a href='index.php?rt=tailieu&page=".$tien."'><strong><font color='#FF0000'> - ".$txtnext."</font></strong></a> ";		
							}
							?>
						</div>
						
					</div>
			</div>
			<div id="m-right">
			
				<div class="sidebar">
					<?php include "newest.php";?>
				</div><!-- end of sidebar -->
				<div id="search">
					<div>
						<a href="#" id="langen">
							<img src="<?php echo ROOT_PATH?>/images/en.png" alt="English"/>
						</a>
						<a href="#" id="langvi">
							<img src="<?php echo ROOT_PATH?>/images/vi.png" alt="Vietnamese"/>
						</a>
					</div>
					<div>
						<form name="frmSearch" action="<?php echo ROOT_PATH?>/search" method="post">
							<input type="text" name="key" id="txtKeyWord" size="20"/>
							<input type="submit" id="btnSearch" value=""/>
						</form>
					</div>
							
				</div>
				<div id="login">
					<div class="l-top">

							<a href="#" onclick="showlogin()">Login</a>
							<a href="index.html">Site Map</a>
							<a href="#"><img src="<?php echo ROOT_PATH?>/images/mail.jpg" alt="Mail"/></a>
					</div>
                     <div id="showlogin">
						 <span style="height:30px;color:#00C;font-size:14px"><?php if($_SESSION["UserIDst"]!="") echo "<a href='/tnu/editinfo.php'>".$_SESSION["User"]."</a>"."  "."<a href='/tnu/logout.php'>đăng xuất</a>"; ?> </span>
                        
                     </div>

						<div class="l-bottom">
							<div class="a1">
							<a href="#"><?php echo ($lang==0)?"Liên kết website":"Website links";?></a>
							
							</div>
							<div class="a2">
							  <select onChange="window.open(this.value);">
                              <option>--Website liên kết--</option>
                             <?php
							  	
							  while($rowweb=mysql_fetch_array($kq1))
							 {
                              echo "<option value='".$rowweb["url"]."'>" .$rowweb["name"]."</option>";
							 }
							?>
                              </select>
							 
							</div>	

					
					
						</div>
					</div><!-- end of login -->
			</div>
			<div class="clear-fix"></div>
		</div>
    </div>
	<?php include "footer.php";?>
	</div>
</body>
</html>	
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
     